package com.Smart.smartscals.Fragment;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.Smart.smartscals.Activity.ActivityMain;
import com.Smart.smartscals.Activity.R;
import com.Smart.smartscals.CustomView.CustomDialogClearAllView;
import com.Smart.smartscals.CustomView.CustomDialogView;
import com.Smart.smartscals.Utils.Tools;

public class FragmentMainSet extends BaseFragment {

	private RelativeLayout layoutAboutUs, layoutClearAll,layoutEditInfor,layoutCloud;
	private CustomDialogView mCustomDialogView;
	private CustomDialogClearAllView mCustomDialogClearAllView;
	private FragmentMainChangeUserInformation mFragmentMainChangeUserInformation;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mView = inflater.inflate(R.layout.fragment_main_set, null);
		// TODO Auto-generated method stub
		return mView;
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		initView();
		initParam();
		initListener();
	}

	private void initListener() {

		layoutAboutUs.setOnClickListener(this);
		layoutClearAll.setOnClickListener(this);
		layoutEditInfor.setOnClickListener(this);
		layoutCloud.setOnClickListener(this);

	}

	private void initParam() {
		mFragmentMainChangeUserInformation = new FragmentMainChangeUserInformation();

	}

	private void initView() {
		layoutAboutUs = (RelativeLayout) mView
				.findViewById(R.id.main_fragment_set_aboutus);
		layoutClearAll = (RelativeLayout) mView
				.findViewById(R.id.main_fragment_set_clear);
		layoutEditInfor = (RelativeLayout)mView.findViewById(R.id.main_fragment_set_seteditinfomation);
		layoutCloud = (RelativeLayout)mView.findViewById(R.id.main_fragment_set_cloud);
		mCustomDialogView = new CustomDialogView(this.getActivity(),
				R.style.customdialog_aboutus);
		mCustomDialogClearAllView = new CustomDialogClearAllView(
				this.getActivity(), R.style.customdialog_aboutus);

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		super.onClick(v);
		switch (v.getId()) {

		case R.id.main_fragment_set_seteditinfomation:
			Tools.startActivityUnFinishActivity(this.getActivity(), this.getActivity(), com.Smart.smartscals.Activity.ActivitySetUserInformation.class);
			
			break;
		case R.id.main_fragment_set_aboutus:

			mCustomDialogView.show();
			break;
		case R.id.main_fragment_set_clear:

			mCustomDialogClearAllView.show();
			break;
		case R.id.main_fragment_set_cloud:

			Tools.startActivityUnFinishActivity(this.getActivity(), this.getActivity(), com.Smart.smartscals.Activity.ActivityCloud.class);
			break;

		default:
			break;
		}
	}
}
